/***********************************************************************************************//**
 * \file   advertisement.h
 * \brief  Header file related to connectable advertisement
 ***************************************************************************************************
 * <b> (C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
 ***************************************************************************************************
 * This file is licensed under the Silabs License Agreement. See the file
 * "Silabs_License_Agreement.txt" for details. Before using this software for
 * any purpose, you must agree to the terms of that agreement.
 **************************************************************************************************/

#ifndef ADV_H
#define ADV_H

#ifdef __cplusplus
extern "C" {
#endif

/***********************************************************************************************//**
 * \defgroup adv Advertisement
 * \brief Advertisement API
 **************************************************************************************************/

/***********************************************************************************************//**
 * @addtogroup Features
 * @{
 **************************************************************************************************/

/***********************************************************************************************//**
 * @addtogroup adv
 * @{
 **************************************************************************************************/

/***************************************************************************************************
  Public Macros and Definitions
***************************************************************************************************/

#define ADV_TX_POWER      0xc3
#define ADV_FLAGS_LEN     2
#define ADV_UUID_LEN      5
#define ADV_TX_POWER_LEN  2

/***************************************************************************************************
  Public Function Declarations
***************************************************************************************************/

/***********************************************************************************************//**
 *  \brief  Initialise Advertisement.
 *  \details  Advertisement plugin initialisation.
 **************************************************************************************************/
void advInit(void);

/***********************************************************************************************//**
 *  \brief  Setup advertising.
 **************************************************************************************************/
void advSetup(void);

/**********************************************************************************************//**
 *  \brief  Stop advertising current message and prepare for advertising a different message.
 **************************************************************************************************/
void advSwitchAdvMessage(void);

/***********************************************************************************************//**
 *  \brief  Init advertising name.
 *  \param[in]  deviceName  New device name to be advertised.
 *  \param[in]  devId  Device Id.
 **************************************************************************************************/
void advInitAdvName(const char *deviceName, uint16 devId);

/***********************************************************************************************//**
 *  \brief  Indicate that connection has started.
 **************************************************************************************************/
void advConnectionStarted(void);

/***********************************************************************************************//**
 *  \brief  Stop advertisement immediately.
 **************************************************************************************************/
void advStopAdvertising(void);

/***********************************************************************************************//**
 *  \brief  Initialize custom advertisement content.
 *  This function must be called when custom user defined advertising content is to be used.
 *  \param[in]  dataLen  Length of custom advertising data.
 *  \param[in]  pData  Pointer to custom advertising data. This must be a static structure.
 *  \param[in]  scanDatalen  Length of custom scan response data.
 *  \param[in]  pScanData  Pointer to custom scan response data. This must be a static structure.
 **************************************************************************************************/
void advInitCustomAdvertising(uint8_t dataLen, uint8_t *pData, uint8_t scanDatalen, uint8_t *pScanData);


/** @} (end addtogroup adv) */
/** @} (end addtogroup Features) */

#ifdef __cplusplus
};
#endif

#endif /* ADV_H */
